import {getAdress,addAdress,delAdress} from '../../api/adress';

export function adressAction(){
    return async(dispatch:Function)=>{
        const result = await getAdress();
        dispatch({
            type:'INIT_ADRESS',
            payload:result.data
        })
    }
}
export function delAdressAction(id:string){
    return async(dispatch:Function)=>{
        const result = await delAdress(id);
        alert(result.data)
        // dispatch({
        //     type:'DEL_ADRESS',
        //     payload:result.data
        // })
    }
}
export function addAdressAction(info:{[key:string]:any}){
    return async(dispatch:Function)=>{
        const result = await addAdress(info);
        dispatch({
            type:'ADD_ADRESS',
            payload:result.data
        })
    }
}
